Optimal. Leaf size=125 \[ \frac {2 a^2 x}{(c-i d)^3}-\frac {2 a^2 \log (c \cos (e+f x)+d \sin (e+f x))}{(i c+d)^3 f}+\frac {a^2 (i c-d)}{2 d (i c+d) f (c+d \tan (e+f x))^2}+\frac {2 i a^2}{(c-i d)^2 f (c+d \tan (e+f x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.18, antiderivative size = 125, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.143, Rules used = {3623, 3610,
3612, 3611} \begin {gather*} \frac {2 i a^2}{f (c-i d)^2 (c+d \tan (e+f x))}+\frac {a^2 (-d+i c)}{2 d f (d+i c) (c+d \tan (e+f x))^2}-\frac {2 a^2 \log (c \cos (e+f x)+d \sin (e+f x))}{f (d+i c)^3}+\frac {2 a^2 x}{(c-i d)^3} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3610
Rule 3611
Rule 3612
Rule 3623
Rubi steps
\begin {align*} \int \frac {(a+i a \tan (e+f x))^2}{(c+d \tan (e+f x))^3} \, dx &=\frac {a^2 (i c-d)}{2 d (i c+d) f (c+d \tan (e+f x))^2}+\frac {\int \frac {2 a^2 (c+i d)+2 a^2 (i c-d) \tan (e+f x)}{(c+d \tan (e+f x))^2} \, dx}{c^2+d^2}\\ &=\frac {a^2 (i c-d)}{2 d (i c+d) f (c+d \tan (e+f x))^2}+\frac {2 i a^2}{(c-i d)^2 f (c+d \tan (e+f x))}+\frac {\int \frac {2 a^2 (c+i d)^2+2 i a^2 (c+i d)^2 \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{\left (c^2+d^2\right )^2}\\ &=\frac {2 a^2 x}{(c-i d)^3}+\frac {a^2 (i c-d)}{2 d (i c+d) f (c+d \tan (e+f x))^2}+\frac {2 i a^2}{(c-i d)^2 f (c+d \tan (e+f x))}-\frac {\left (2 a^2\right ) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{(i c+d)^3}\\ &=\frac {2 a^2 x}{(c-i d)^3}-\frac {2 a^2 \log (c \cos (e+f x)+d \sin (e+f x))}{(i c+d)^3 f}+\frac {a^2 (i c-d)}{2 d (i c+d) f (c+d \tan (e+f x))^2}+\frac {2 i a^2}{(c-i d)^2 f (c+d \tan (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Both result and optimal contain complex but leaf count is larger than twice
the leaf count of optimal. \(317\) vs. \(2(125)=250\).
time = 4.53, size = 317, normalized size = 2.54 \begin {gather*} \frac {a^2 (\cos (e+f x)+i \sin (e+f x))^2 \left (\frac {\log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right ) (-i \cos (2 e)-\sin (2 e))}{f}+4 x (\cos (2 e)-i \sin (2 e))-\frac {2 \text {ArcTan}\left (\frac {\left (-3 c^2 d+d^3\right ) \cos (3 e+f x)+c \left (c^2-3 d^2\right ) \sin (3 e+f x)}{c \left (c^2-3 d^2\right ) \cos (3 e+f x)-d \left (-3 c^2+d^2\right ) \sin (3 e+f x)}\right ) (\cos (2 e)-i \sin (2 e))}{f}+\frac {(c-i d) d (\cos (2 e)-i \sin (2 e))}{2 f (c \cos (e+f x)+d \sin (e+f x))^2}-\frac {(c-i d) (c+2 i d) (\cos (2 e)-i \sin (2 e)) \sin (f x)}{f (c \cos (e)+d \sin (e)) (c \cos (e+f x)+d \sin (e+f x))}\right )}{(c-i d)^3 (\cos (f x)+i \sin (f x))^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.31, size = 216, normalized size = 1.73
method | result | size |
derivativedivides | \(\frac {a^{2} \left (\frac {\frac {\left (2 i c^{3}-6 i c \,d^{2}-6 c^{2} d +2 d^{3}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (6 i c^{2} d -2 i d^{3}+2 c^{3}-6 c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{3}}-\frac {-2 i c d -c^{2}+d^{2}}{2 \left (c^{2}+d^{2}\right ) d \left (c +d \tan \left (f x +e \right )\right )^{2}}+\frac {2 i c^{2}-2 i d^{2}-4 c d}{\left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}-\frac {2 \left (i c^{3}-3 i c \,d^{2}-3 c^{2} d +d^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{3}}\right )}{f}\) | \(216\) |
default | \(\frac {a^{2} \left (\frac {\frac {\left (2 i c^{3}-6 i c \,d^{2}-6 c^{2} d +2 d^{3}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (6 i c^{2} d -2 i d^{3}+2 c^{3}-6 c \,d^{2}\right ) \arctan \left (\tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{3}}-\frac {-2 i c d -c^{2}+d^{2}}{2 \left (c^{2}+d^{2}\right ) d \left (c +d \tan \left (f x +e \right )\right )^{2}}+\frac {2 i c^{2}-2 i d^{2}-4 c d}{\left (c^{2}+d^{2}\right )^{2} \left (c +d \tan \left (f x +e \right )\right )}-\frac {2 \left (i c^{3}-3 i c \,d^{2}-3 c^{2} d +d^{3}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right )^{3}}\right )}{f}\) | \(216\) |
risch | \(-\frac {4 a^{2} x}{3 i c^{2} d -i d^{3}-c^{3}+3 c \,d^{2}}-\frac {4 i a^{2} x}{i c^{3}-3 i c \,d^{2}+3 c^{2} d -d^{3}}-\frac {4 i a^{2} e}{f \left (i c^{3}-3 i c \,d^{2}+3 c^{2} d -d^{3}\right )}-\frac {2 i \left (3 a^{2} d^{2} {\mathrm e}^{2 i \left (f x +e \right )}+2 i a^{2} c d \,{\mathrm e}^{2 i \left (f x +e \right )}-2 a^{2} d^{2}+a^{2} c^{2} {\mathrm e}^{2 i \left (f x +e \right )}+3 i a^{2} c d +a^{2} c^{2}\right )}{\left (-i {\mathrm e}^{2 i \left (f x +e \right )} d +i d +{\mathrm e}^{2 i \left (f x +e \right )} c +c \right )^{2} f \left (-i d +c \right )^{3}}+\frac {2 a^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right )}{f \left (i c^{3}-3 i c \,d^{2}+3 c^{2} d -d^{3}\right )}\) | \(290\) |
norman | \(\frac {\frac {2 i a^{2} c d +a^{2} c^{2}+a^{2} d^{2}}{2 f \left (-2 i c d +c^{2}-d^{2}\right ) d}+\frac {2 a^{2} c^{2} x}{\left (-i d +c \right ) \left (-2 i c d +c^{2}-d^{2}\right )}+\frac {i d^{2} a^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{\left (2 i c d -c^{2}+d^{2}\right ) f c}+\frac {4 c d \,a^{2} x \tan \left (f x +e \right )}{\left (-i d +c \right ) \left (-2 i c d +c^{2}-d^{2}\right )}-\frac {2 i a^{2} d^{2} x \left (\tan ^{2}\left (f x +e \right )\right )}{\left (i c +d \right ) \left (2 i c d -c^{2}+d^{2}\right )}}{\left (c +d \tan \left (f x +e \right )\right )^{2}}+\frac {i a^{2} \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{f \left (-3 i c^{2} d +i d^{3}+c^{3}-3 c \,d^{2}\right )}-\frac {2 i a^{2} \ln \left (c +d \tan \left (f x +e \right )\right )}{f \left (-3 i c^{2} d +i d^{3}+c^{3}-3 c \,d^{2}\right )}\) | \(305\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Both result and optimal contain complex but leaf count of result is larger than
twice the leaf count of optimal. 386 vs. \(2 (115) = 230\).
time = 0.52, size = 386, normalized size = 3.09 \begin {gather*} \frac {\frac {4 \, {\left (a^{2} c^{3} + 3 i \, a^{2} c^{2} d - 3 \, a^{2} c d^{2} - i \, a^{2} d^{3}\right )} {\left (f x + e\right )}}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} - \frac {4 \, {\left (i \, a^{2} c^{3} - 3 \, a^{2} c^{2} d - 3 i \, a^{2} c d^{2} + a^{2} d^{3}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} - \frac {2 \, {\left (-i \, a^{2} c^{3} + 3 \, a^{2} c^{2} d + 3 i \, a^{2} c d^{2} - a^{2} d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{6} + 3 \, c^{4} d^{2} + 3 \, c^{2} d^{4} + d^{6}} + \frac {a^{2} c^{4} + 6 i \, a^{2} c^{3} d - 8 \, a^{2} c^{2} d^{2} - 2 i \, a^{2} c d^{3} - a^{2} d^{4} + 4 \, {\left (i \, a^{2} c^{2} d^{2} - 2 \, a^{2} c d^{3} - i \, a^{2} d^{4}\right )} \tan \left (f x + e\right )}{c^{6} d + 2 \, c^{4} d^{3} + c^{2} d^{5} + {\left (c^{4} d^{3} + 2 \, c^{2} d^{5} + d^{7}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (c^{5} d^{2} + 2 \, c^{3} d^{4} + c d^{6}\right )} \tan \left (f x + e\right )}}{2 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 316 vs. \(2 (115) = 230\).
time = 0.90, size = 316, normalized size = 2.53 \begin {gather*} \frac {2 \, {\left (a^{2} c^{2} + 3 i \, a^{2} c d - 2 \, a^{2} d^{2} + {\left (a^{2} c^{2} + 2 i \, a^{2} c d + 3 \, a^{2} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (a^{2} c^{2} + 2 i \, a^{2} c d - a^{2} d^{2} + {\left (a^{2} c^{2} - 2 i \, a^{2} c d - a^{2} d^{2}\right )} e^{\left (4 i \, f x + 4 i \, e\right )} + 2 \, {\left (a^{2} c^{2} + a^{2} d^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (\frac {{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right )\right )}}{{\left (i \, c^{5} + 5 \, c^{4} d - 10 i \, c^{3} d^{2} - 10 \, c^{2} d^{3} + 5 i \, c d^{4} + d^{5}\right )} f e^{\left (4 i \, f x + 4 i \, e\right )} - 2 \, {\left (-i \, c^{5} - 3 \, c^{4} d + 2 i \, c^{3} d^{2} - 2 \, c^{2} d^{3} + 3 i \, c d^{4} + d^{5}\right )} f e^{\left (2 i \, f x + 2 i \, e\right )} + {\left (i \, c^{5} + c^{4} d + 2 i \, c^{3} d^{2} + 2 \, c^{2} d^{3} + i \, c d^{4} + d^{5}\right )} f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 391 vs. \(2 (100) = 200\).
time = 4.20, size = 391, normalized size = 3.13 \begin {gather*} - \frac {2 i a^{2} \log {\left (\frac {c + i d}{c e^{2 i e} - i d e^{2 i e}} + e^{2 i f x} \right )}}{f \left (c - i d\right )^{3}} + \frac {- 2 i a^{2} c^{2} + 6 a^{2} c d + 4 i a^{2} d^{2} + \left (- 2 i a^{2} c^{2} e^{2 i e} + 4 a^{2} c d e^{2 i e} - 6 i a^{2} d^{2} e^{2 i e}\right ) e^{2 i f x}}{c^{5} f - i c^{4} d f + 2 c^{3} d^{2} f - 2 i c^{2} d^{3} f + c d^{4} f - i d^{5} f + \left (2 c^{5} f e^{2 i e} - 6 i c^{4} d f e^{2 i e} - 4 c^{3} d^{2} f e^{2 i e} - 4 i c^{2} d^{3} f e^{2 i e} - 6 c d^{4} f e^{2 i e} + 2 i d^{5} f e^{2 i e}\right ) e^{2 i f x} + \left (c^{5} f e^{4 i e} - 5 i c^{4} d f e^{4 i e} - 10 c^{3} d^{2} f e^{4 i e} + 10 i c^{2} d^{3} f e^{4 i e} + 5 c d^{4} f e^{4 i e} - i d^{5} f e^{4 i e}\right ) e^{4 i f x}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 472 vs. \(2 (115) = 230\).
time = 0.74, size = 472, normalized size = 3.78 \begin {gather*} \frac {2 \, {\left (\frac {a^{2} \log \left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - c\right )}{i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} - d^{3}} - \frac {2 \, a^{2} \log \left (-i \, \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{i \, c^{3} + 3 \, c^{2} d - 3 i \, c d^{2} - d^{3}} + \frac {3 \, a^{2} c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} - 2 i \, a^{2} c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 10 \, a^{2} c^{3} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 6 i \, a^{2} c^{2} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 2 \, a^{2} c d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 6 \, a^{2} c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 i \, a^{2} c^{3} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 6 \, a^{2} c^{2} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 10 i \, a^{2} c d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 \, a^{2} d^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 i \, a^{2} c^{4} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 10 \, a^{2} c^{3} d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 6 i \, a^{2} c^{2} d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 2 \, a^{2} c d^{3} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 3 \, a^{2} c^{4}}{-2 \, {\left (i \, c^{5} + 3 \, c^{4} d - 3 i \, c^{3} d^{2} - c^{2} d^{3}\right )} {\left (c \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 2 \, d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - c\right )}^{2}}\right )}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.51, size = 297, normalized size = 2.38 \begin {gather*} -\frac {\frac {a^2\,c^2+a^2\,c\,d\,4{}\mathrm {i}+a^2\,d^2}{2\,d^3\,\left (-c^2+c\,d\,2{}\mathrm {i}+d^2\right )}+\frac {a^2\,\mathrm {tan}\left (e+f\,x\right )\,2{}\mathrm {i}}{d\,\left (-c^2+c\,d\,2{}\mathrm {i}+d^2\right )}}{f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^2+\frac {c^2}{d^2}+\frac {2\,c\,\mathrm {tan}\left (e+f\,x\right )}{d}\right )}+\frac {a^2\,\mathrm {atan}\left (\frac {c^3-c^2\,d\,1{}\mathrm {i}+c\,d^2-d^3\,1{}\mathrm {i}}{{\left (c-d\,1{}\mathrm {i}\right )}^2\,\left (d+c\,1{}\mathrm {i}\right )}-\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (2\,c^8\,d^2+8\,c^6\,d^4+12\,c^4\,d^6+8\,c^2\,d^8+2\,d^{10}\right )\,1{}\mathrm {i}}{{\left (c-d\,1{}\mathrm {i}\right )}^2\,\left (d+c\,1{}\mathrm {i}\right )\,\left (-c^6\,d\,1{}\mathrm {i}+2\,c^5\,d^2-c^4\,d^3\,1{}\mathrm {i}+4\,c^3\,d^4+c^2\,d^5\,1{}\mathrm {i}+2\,c\,d^6+d^7\,1{}\mathrm {i}\right )}\right )\,4{}\mathrm {i}}{f\,{\left (c-d\,1{}\mathrm {i}\right )}^2\,\left (d+c\,1{}\mathrm {i}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________